#include <bits/stdc++.h>
using namespace std;

typedef long long LL;

const int N = 1e5 + 10;

int n;
int a[N];
int cnt[N];
int last[N];

int main()
{
	freopen("duel.in", "r", stdin);
	freopen("duel.out", "w", stdout);
	cin >> n;
	for(int i = 1; i <= n; ++ i) cin >> a[i];
	sort(a + 1, a + n + 1);
	int b = 0;
	for(int i = 1; i <= n; ++ i)
	{
		if(a[i] != a[i - 1]) b ++;
		cnt[b] ++;
	}
	int mi = 1;
	int res = 0;
	for(int i = 2; i <= b; ++ i)
	{
		if(cnt[mi] > cnt[i])
		{
			res += cnt[i];
			cnt[mi] -= cnt[i];
		}
		else
		{
			memcpy(last, cnt, sizeof cnt);
			while(last[mi] <= last[i] && mi < i)
			{
				res += last[mi];
				last[i] -= last[mi];
				mi ++;
			}
		}
	}
	cout << n - res;
	
	return 0;
}
